package com.kaifamiao.demo.d0721;

import java.util.Arrays;

public class Demo08 {

    public static void main(String[] args) {
        int[] arr = new int[] {2, 3, 4, 5, 6, 7, 8};

        int index = Arrays.binarySearch(arr, 7);
        System.out.println(index);

        // [2, 4)
        int[] arr1 = Arrays.copyOfRange(arr, 2, 4);
        for(int i = 0; i < arr1.length; i ++){
            System.out.println(arr1[i]);
        }

//        int[] aa = null; // 除了赋值以外不能进行任何操作
//        aa[0] = 1;
        int[] a1 = {2, 2};
        int[] a2 = {2, 1};

        int key = Arrays.compare(a1, a2);
        boolean result = Arrays.equals(a1, a2);

        System.out.println(key);
        System.out.println(result);
    }
}
